<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  <link rel="stylesheet" href="css/mui.min.css" />
  <link rel="stylesheet" href="css/trace.css?v=20200108" />
  <title></title>
</head>
<body>
<div class='wrap'>
  <div class="a">
    <div class="head">
      <div class="logo_div">
        <img src="img/logo_3.png" style="width: 100%;left: 0px;top: 0px;position: absolute"/>
<!--        <img src="img/logoIcon1.png" style="position: absolute;-->
<!--    width: 12%;-->
<!--    top: 12px;-->
<!--    left: 26px;-->
<!--    width: 50px;"/>-->
<!--        <img src="img/logo_2.png" />-->
      </div>
    </div>
    <div id="trace_num_info" style="padding-top: 110px;position: relative;">
      <!--基本信息-->
      <div class="box02">
        <div class="title_spec" style="text-align: center;">
          <img src="img/jbxx.png" class="info_name"
               style="height: 50px;width: 100px;margin-top: 20px;">
        </div>
        <div id="logo" class="imgs" >
        </div>
        <div class="list-2 ">
          <img src="img/icon1.png" alt="">
          产品名称 :
          <span id="productName"></span>
        </div>
        <div class="list-2 ">
          <img src="img/icon1.png" alt="">
          产品别名 :
          <span id="aliasName"></span>
        </div>
        <div class="list-2 mui-hidden" id="zzly">
          <img src="img/icon1.png" alt="">
          种子来源 :
          <span id="proFactory"></span>
        </div>
        <div class="list-2">
          <img src="img/icon4.png" alt="">
          产品功效 ：
          <span id="introduction"></span>
        </div>
        <div class="list-2">
          <img src="img/icon4.png" alt="">
          产品性状 ：
          <span id="appearance"></span>
        </div>
        <div class="list-2" id="baseDiv">
          <img src="img/icon6.png" alt="">
          基地名称 ：
          <span id="base"></span>
        </div>
        <div class="list-2" id="baseAddressDiv">
          <img src="img/icon9.png" alt="">
          基地地址 ：
          <span id="baseAddress"></span>
        </div>
      </div>
      <!--企业质检报告-->
      <!--					<div class="box02 mui-hidden" id="testImgDiv">-->
      <!--						<div class="title_spec">-->
      <!--							<img src="img/cpzljcbg.png" class="info_name">-->
      <!--							<div class="arrow-line"></div>-->
      <!--						</div>-->
      <!--						<div class="imgs" id="testImg">-->
      <!--						</div>-->
      <!--					</div>-->
      <!--法定检测报告-->
      <div class="box02 mui-hidden" id="hgjcjgDiv">
        <div class="title_spec">
          <img src="img/hgjcjg.png" class="info_name">
          <div class="arrow-line"></div>
        </div>
        <div class="control-disp hid" id="hgjcjgContent">
          <button id="downloadPdf" style="margin-left: 38px">监测报告下载</button>
          <div class="imgs"  id="customCheck" style="line-height: 26px;font-size: 14px;">

          </div>
        </div>
      </div>
      <!--企业简介-->
      <div class="box02">
        <div class="title_spec">
          <img src="img/qyjj.png"  class="info_name">
        </div>
        <div class="imgs" id="enterpriseImageDiv"
             style="display: none;">
          <div class="imgs" id="enterpriseImage">
          </div>
        </div>

        <div class="list-2">
          <img src="img/icon5.png">
          企业名称 :
          <span id="enterpriseName"></span>
        </div>
        <div class="list-2 ">
          <img src="img/icon7.png" >
          企业负责人：
          <span id="principal"></span>
        </div>
<!--        <div class="list-2">-->
<!--          <img src="img/icon8.png" alt="">-->
<!--          联系电话：-->
<!--          <span id="telephone"></span>-->
<!--        </div>-->
        <div class="list-2 ">
          <img src="img/icon7.png" >
          质量负责人：
          <span id="enterprisePrincipal"></span>
        </div>
        <div class="list-2">
          <img src="img/icon8.png" alt="">
          联系电话：
          <span id="enterpriseTelephone"></span>
        </div>
        <div class="list-2">
          <img src="img/icon5.png">
          企业简介 :
          <span id="enterpriseComments"></span>
        </div>
        <div class="list-2">
          <img src="img/icon9.png" alt="">
          地址：
          <span id="enterpriseAddress"></span>
        </div>
      </div>
      <!--营业执照-->
      <div class="box02 mui-hidden" id="yyzzDiv">
        <div class="title_spec">
          <img src="img/yyzz.png" class="info_name">
          <div class="arrow-line"></div>
        </div>
        <div class="control-disp hid">
          <div class="imgs"  id="yyzzImage" style="line-height: 26px;font-size: 14px;">

          </div>
        </div>
      </div>
      <div class="box02">
        <div class="title_spec">
          <img src="img/scjddtdh.png"  class="info_name">
          <div class="arrow-line"></div>
        </div>
        <div class="control-disp hid">
          <div class="maps">
            <div id="container">
            </div>
          </div>
        </div>
      </div>
      <!--而港澳菜篮子-->
      <div class="box02" id="clzCertimgDiv" style="display: none;">
        <div class="title_spec">
          <img src="img/clzrzzs.png" class="info_name">
          <div class="arrow-line"></div>
        </div>
        <div class="control-disp hid">
          <div class="imgs">
            <img id="clzCertimg"  data-preview-src="" data-preview-group="hkamCert"/>
          </div>
        </div>
      </div>

      <!--生态农事管理-->
      <div class="box02" id="stnsglRow" style="display: none;">
        <div class="title_spec">
          <img src="img/stnsgl.png"  class="info_name">
          <div class="arrow-line"></div>
        </div>
        <div id="stnslist" class="control-disp hid">

        </div>
      </div>
      <div class="box02" id="jggcDiv" style="display: none;">
        <div class="title_spec">
          <img src="img/jggc.png"  class="info_name">
          <div class="arrow-line"></div>
        </div>
        <div id="jggclist" class="control-disp hid">
        </div>
      </div>
      <div class="box02 mui-hidden" id="realSceneImgsDiv">
        <div class="title_spec">
          <img src="img/scjgsj.png"  class="info_name">
          <div class="arrow-line"></div>
        </div>
        <div class="control-disp hid">
          <div class="imgs" id="realSceneImgs">
          </div>
        </div>
      </div>
      <div class="box02 mui-hidden" id="techSpecImgDiv">
        <div class="title_spec">
          <img src="img/scgfhzxbz.png" class="info_name">
          <div class="arrow-line">
          </div>
        </div>
        <div class="control-disp hid">
          <div class="imgs" id="techSpecImg">
            <img src="img/jcbg.png" />
          </div>
        </div>
      </div>
      <div class="box02" id="qcImgDiv" style="display: none;">
        <div class="title_spec">
          <img src="img/qczlkzlc.png" alt="" class="info_name">
          <div class="arrow-line">
          </div>
        </div>
        <div class="control-disp hid">
          <div class="imgs" id="qcImg">
            <img src="img/jcbg.png" />
          </div>
        </div>
      </div>

      <div class="box02" id="certImgsDiv" style="display: none;">
        <div class="title_spec">
          <img src="img/qyzz.png"  class="info_name">
          <div class="arrow-line">
          </div>
        </div>
        <div class="control-disp hid">
          <div class="imgs" id="certImgs">
          </div>
        </div>
      </div>
      <div class="box02" id="hkamCertimgDiv" style="display: none;">
        <div class="title_spec">
          <img src="img/ggajdbazs.png" class="info_name">
          <div class="arrow-line"></div>
        </div>
        <div class="control-disp hid">
          <div class="imgs">
            <img id="hkamCertimg"  data-preview-src="" data-preview-group="hkamCert"/>
          </div>
        </div>
      </div>

    </div>
  </div>
</div>








<script src="https://webapi.amap.com/maps?v=1.4.10&key=d9e28242d75be331682608db111d773c&plugin=AMap.AdvancedInfoWindow"></script>
<script src="js/jquery-1.11.1.js"></script>
<script src="js/mui.min.js"></script>
<script src="js/mui.previewimage.js"></script>
<script src="js/mui.zoom.js"></script>
<script src="js/common.js"></script>
<script src="js/jquery.s2t.js"></script>
<script src="js/ezuikit.js"></script>
<script type="text/javascript" charset="utf-8">

  //创建地图实例
  map = new AMap.Map("container", {
    resizeEnable: true,
    zoom: 10,
    center: [102.91132619,24.82696017]
  });
  mui.init({
    swipeBack:true //启用右滑关闭功能
  });
  mui.init({
    swipeBack:true //启用右滑关闭功能
  });


  $("#pjclosebtn").click(function(){
    mui('#pjpopover').popover('hide');
  });

  $("#closebtn").click(function(){
    mui("#popover").popover('toggle');
  });

  //匿名评价
  var isclick = false;
  function change(mydivid,num) {
    if (!isclick) {
      var tds = $("#"+mydivid+" ul li");
      for (var i = 0; i < num; i++) {
        var td = tds[i];
        $(td).find("img").attr("src","img\/star_full.png");
      }
      var tindex = $("#"+mydivid).attr("currentIndex");
      tindex = tindex==0?0:tindex+1;
      for (var j = num; j < tindex; j++) {
        var td = tds[j];
        $(td).find("img").attr("src","img\/star_empty.png");
      }
      $("#"+mydivid).attr("currentIndex",num);
    }
  }

  function repeal(mydivid,num) {
    if (!isclick) {
      var tds = $("#"+mydivid+" ul li");
      var tindex = $("#"+mydivid).attr("currentIndex");
      tindex = tindex==0?0:tindex+1;
      for (var i = tindex; i < num; i++) {
        var td = tds[i];
        $(td).find("img").attr("src","images\/star_empty.png");
      }
      $("#"+mydivid).attr("currentIndex",num);
    }
  }
  function change1(mydivid,num) {
    if (!isclick) {
      change(mydivid,num);

    }
    else {
      alert("Sorry,You had clicked me!");
    }
  }
  $(function(){
    initEvent('mydiv1');
  });
  function initEvent(mydivid) {
    var tds = $("#"+mydivid+" ul li");
    for (var i = 0; i < tds.length; i++) {
      var td = tds[i];
      $(td).on('mouseover',function(){var num = $(this).attr("num");change(mydivid,num);});
      $(td).on('click',function(){var num = $(this).attr("num");change1(mydivid,num);});
    }
  }
  function getQueryVariable(variable)
  {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i=0;i<vars.length;i++) {
      var pair = vars[i].split("=");
      if(pair[0] == variable){return pair[1];}
    }
    return('');
  }
  var source = getQueryVariable("source");
  initData(source);
  function initData(source){
    var searchId = getQueryVariable("searchId");
    var type = getQueryVariable("type");
    var searchParam={source:source,searchId:searchId}
    /* if(type == "attachedList"){
        searchParam.type = type;
    } */
    if(source===3){
      $("#certificationDiv").hide();
      $("#baseDiv").hide();
    }
    if(source===2){
      var isPreSale = getQueryVariable("isPreSale");
      var startTime = getQueryVariable("startTime");
      var endTime = getQueryVariable("endTime");
      if(isPreSale){
        searchParam.isPreSale=isPreSale;
      }
      if(startTime){
        searchParam.startTime=startTime;
      }
      if(endTime){
        searchParam.isPreSale=endTime;
      }
    }

    request_uri = request_uri+"vegetable/vegetableTypes/getVegetableInfo?vegetableId="+getQueryVariable("vegetableId");
    $.ajax({
      //url:"http://10.10.201.58:3001/aptmp-trace/trace/tracedata.json",
      url:request_uri,
      type:"get",
      data:searchParam,
      async:false,
      dataType : "json", // 返回的数据类型，设置为JSONP方式
      //jsonp : 'callback', //指定一个查询参数名称来覆盖默认的 jsonp 回调参数名 callback
      //jsonpCallback: 'callback', //设置回调函数名
      success:function(res){
        if(res.code!==200){
          //未经过 检测判断
          if(res.status===410){
            var proName =res.msg;
            $("#trace_num_info").html("");
            var errorMsg =`<div style=" padding: 30px; font-size: 16px;line-height: 21px;font-family: cursive;">该产品（${proName}）尚未经过粤港澳大湾区“菜篮子”平台检测。</div>`;
            $("#trace_num_info").append(errorMsg).show();
            return;
          }else if(res.code===500){
            $("#trace_num_info").html("");
            var errorMsg =`<div style=" padding: 30px; font-size: 16px;line-height: 21px;font-family: cursive;">${res.msg}</div>`;
            $("#trace_num_info").append(errorMsg).show();
            return;
          }else{
            mui.toast("接口请求异常，请联系管理员");
            return false;
          }
        }else{
          //特殊判断 检测结果为空
          // let customCheck = res.data.customCheck;//checkVOs  customCheck
          // if(customCheck!=null&&customCheck!=""&&source!=2){
          //   if(customCheck.checkedResult==null){
          //     var proName =res.data.productName;
          //     $("#trace_num_info").html("");
          //     var errorMsg =`<div style=" padding: 30px; font-size: 16px;line-height: 21px;font-family: cursive;">该产品（${proName}）尚未经过粤港澳大湾区“菜篮子”平台检测。</div>`;
          //     $("#trace_num_info").append(errorMsg).show();
          //     return;
          //   }
          // }
        }
        $("#trace_num_info").show();
        var traceInfo = res.result;//追溯信息
        //var enterprise = res.enterprise;//企业信息
        //产品图片 varietyImage
        var varietyImage = testImgs1(traceInfo.picUrl,"logo");
        $("#logo").append(varietyImage);//产品logo图片

        $("#productName").html(traceInfo.productName);//产品名称
        if(traceInfo.proFactory!=null && traceInfo.proFactory!=""){
          $("#zzly").removeClass("mui-hidden");
          $("#proFactory").html(traceInfo.proFactory);//种子来源
        }

        $("#introduction").html(traceInfo.effect);//产品描述
        $("#appearance").html(traceInfo.appearance);//产品性状
        $("#aliasName").html(traceInfo.aliasName);//产品描述
        $("#certification").html(traceInfo.certification);//生产许可证

        $("#enterpriseName").html(traceInfo.companyName);//企业名称
        $("#base").html(traceInfo.baseName);//种植基地
        $("#baseAddress").html(traceInfo.baseAddress);//种植基地
        //企业信息
        $("#enterpriseComments").html(traceInfo.enterpriseComments);//主体简介
        $("#enterprisePrincipal").html(traceInfo.messenger);
        $("#enterpriseTelephone").html(traceInfo.messengerPhone);
        $("#principal").html(traceInfo.principal);
        // $("#telephone").html(traceInfo.telephone);
        $("#enterpriseAddress").html(traceInfo.companyAddress);

        //主体图片
        var enterpriseImage = traceInfo.entpImgs;
        if(enterpriseImage!=null&&enterpriseImage!=""){
          $("#enterpriseImageDiv").show();
          var imgshtml = testImgs(enterpriseImage,"enterprise");
          $("#enterpriseImage").html(imgshtml);
        }

        // //供港澳基地备案证书
        // $("#hkamCertimgDiv").show();
        // $("#hkamCertimg").attr("src",pre_img+"6da2e5e1-b34a-45e6-a24e-34223ab601ba-3189401");
        // //粤港澳大湾区"菜篮子"生产基地认证证书
        // $("#clzCertimgDiv").show();
        // $("#clzCertimg").attr("src",pre_img+"0218adfb-3abe-40d3-81c5-00cd9d4d417e-3189401");

        //enterpriseImage
        //作业信息
        if(traceInfo.workInfos!=null&&traceInfo.workInfos.length>0){
          $("#stnsglRow").show();
          initWorkInfo(traceInfo.workInfos);
        }
        //加工过程
        if(traceInfo.zProdProcessList!=null&&traceInfo.zProdProcessList.length>0){
          $("#jggcDiv").show();
          initJggcInfo(traceInfo.zProdProcessList);
        }
        //视频信息 prodVideo
        //产品质量报告 :inspectImage
        var testImg = traceInfo.testImg;
        if(testImg!=null&&testImg!=""){
          $("#testImgDiv").removeClass("mui-hidden");
          var testImg = testImgs(testImg,"inspect");
          $("#testImg").html(testImg);
          $("#testImg").find("button").on("click",function(){
            window.open($(this).attr("data"))
          })
        }
        //海关监测结果
        var customCheck = traceInfo.customCheck;//checkVOs  customCheck
        var checkVOs = traceInfo.checkVOs;
        if(customCheck!=null&&customCheck!=""&&source!=2){
          $("#hgjcjgDiv").removeClass("mui-hidden");
          //==1?"合格":"不合格"
          if(customCheck.checkedResult){
            var result = customCheck.checkedResult==1?"合格":"不合格";
            var time =customCheck.checkedAt||'';
            var html='本监测记录为对该生产基地或产品加工企业同产品产品抽检时的质量安全检验检测报告记录，检验检测结果仅对送检和抽检样品负责。产品生产企业对产品质量安全负完全责任。';
            $("#customCheck").append(html);
            if(customCheck.pdfPath){
              $("#downloadPdf").click(function(){
                HandleImageOrPdf(customCheck.pdfPath);//打开逻辑
              })
            }
          }
        }else if(checkVOs!=null&&checkVOs.length>0){
          $("#hgjcjgDiv").removeClass("mui-hidden");
          console.log(checkVOs);
          //走特殊逻辑
          ProcessingDatas(checkVOs);
        }

        //生产加工图片   realSceneImgs
        var realSceneImgs=traceInfo.realSceneImgs;
        if(realSceneImgs!=null&&realSceneImgs!=""){
          $("#realSceneImgsDiv").removeClass("mui-hidden");
          var realSceneImgs = testImgs(traceInfo.realSceneImgs,"realScene");
          $("#realSceneImgs").html(realSceneImgs);
        }
        //执行标准图片 execStImgs
        var techSpecImg = traceInfo.techSpecImg;
        if(techSpecImg!=null&&techSpecImg!=""){
          $("#techSpecImgDiv").removeClass("mui-hidden");
          var techSpecImg = testImgs(techSpecImg,"techSpec");
          $("#techSpecImg").html(techSpecImg);
        }


        //全程质量控制流程
        var qcImg = traceInfo.qcImg;
        if(qcImg!=null&&qcImg!=""){
          $("#qcImgDiv").show();
          var qcImg = testImgs(traceInfo.qcImg,"qcImg");
          $("#qcImg").html(qcImg);
        }
        //营业执照
        $("#yyzzDiv").removeClass("mui-hidden");
        var zsImage = testImgs1("temp/yyzz.jpg","zsImage");
        // var zsImage = testImgs("320307d7-5cf6-48e0-8f63-43b290df06d2-3189401","zsImage");
        $("#yyzzImage").html(zsImage);

        //企业资质
        //certificationImages 资质信息照片
        var certImgs = traceInfo.certImgs;
        if(certImgs!=null&&certImgs!=""){
          $("#certImgsDiv").show();
          var imgshtml = testImgs(certImgs,"certification");
          $("#certImgs").html(imgshtml);
        }
        mui.previewImage();

        var gallery = mui('.mui-slider');
        gallery.slider({interval: 0});

      },error:function(msg){
        console.log(msg);
      },complete(xhr){
        console.log(xhr);
      }
    });
  }
  function HandleImageOrPdf(src){
    let type  = src.substring(src.lastIndexOf(".")+1);//判断后缀 是pdf还是image
    let fileArray = src.split(",");
    let showFile = fileArray[fileArray.length-1];
    if(type!="pdf"){
      window.open(pre_img+showFile);//图片直接打开
    }else{
      //pdf需要判断两种前缀 类型
      let openUrl = "http://gba.gzagri.gov.cn/ppf/file/" + showFile;
      $.ajax({
        url: openUrl,
        type: "get",
        async: false,
        success: function (res) {
        },error:function(){
          openUrl = pre_img + showFile;
        }
      });
      //使用插件打开
      window.open('js/pdf/web/viewer.html?file=' + openUrl, 'PDF');
    }
  }
  function getcheckInfos(checkVOs){
    var html=`<div class="fdjcjg" >`;
    // $.each(checkVOs,function(index,item){
    // 	html+=`<div class="items">监测时间：${item.time||''}<br>监测结果：${item.result==1?'合格':'不合格'} <br>
    // 	<a class="loadReports" data-id=${item.file}>监测报告下载</a></div>`;
    // })
    let item1 = checkVOs[0];
    html+=`<div class="items"><a class="loadReports" data-id=${item1.file}>监测报告下载</a></div>`;
    html+=`<p>本监测记录为对该生产基地或产品加工企业同产品产品抽检时的质量安全检验检测报告记录，检验检测结果仅对送检和抽检样品负责。产品生产企业对产品质量安全负完全责任。</p>`;
    html+=`</div>`;
    $("#hgjcjgContent").html(html);
    $(".loadReports").click(function(){
      var path = $(this).data("id");
      var type = path.substring(path.lastIndexOf(".")+1);;
      if(type=="pdf"){
        var url= "http://gba.gzagri.gov.cn/ppf/file/"+path;
        $.ajax({
          url: url,
          type: "get",
          async: false,
          success: function (res) {
            //window.open(url);
          },error:function(){
            url = pre_img+path;
            //window.open(pre_img+path);
          }
        });
        window.open('js/pdf/web/viewer.html?file=' + url, 'PDF');
      }else{
        window.open(pre_img+path);
      }
    })
  }
  /***处理数据***/
  function ProcessingDatas(checkVOs){
    var arrays=[];
    //var maps=new Map();多次对一个key放入value，后面的值会把前面的值冲掉：
    $.each(checkVOs,function(index,item){
      if(item.pdfPath!=null&&item.pdfPath!=""){
        var obj = {time:item.checkedAt,result:item.auditStatus,file:item.pdfPath};
        arrays.push(obj);
      }
      if(item.testImg!=null&&item.testImg!=""){
        var obj = {time:item.testAt,result:item.auditStatus,file:item.testImg};
        arrays.push(obj);
      }
      if(item.riskSuperviseFile!=null&&item.riskSuperviseFile!=""){
        var obj = {time:item.riskSuperviseAt,result:item.auditStatus,file:item.riskSuperviseFile};
        arrays.push(obj);
      }
    })
    getcheckInfos(sortKey(arrays,'time'));
  }
  function sortKey(array,key){
    return array.sort(function(a,b){
      var x = a[key];
      var y = b[key];
      return ((x<y)?1:(x>y)?-1:0)
    })
  }

  function initWorkInfo(prodList){
    var html='';
    $.each(prodList, function(index,item) {
      //var message = item.message;
      //var arrays = message.split(" ");
      //var czname = arrays[0].split(":");
      //var czTime=arrays[1]+" "+arrays[2];
      var inputsName=item.inputsName!=null?"投入品："+item.inputsName:"";
      var createUser=item.createUser!=null?"负责人："+item.createUser:"";
      var className = index==0?"listItem-first":index==prodList.length-1?"listItem-last":"";
      html+= '<div class="listItem '+className+'">'+
        '<div class="listItemContent">'+
        '<div class="type">'+item.workTypeName+'</div>'+
        '<div class="content">';
      if(item.createdAt!=null){
        html += item.createdAt+'  <br>';
      }
      if(createUser!=""){
        html += createUser +'  <br>';
      }
      if(inputsName!=""){
        html += inputsName;
      }

      html+=	'	</div>'+
        '</div>'+
        '</div>';
    });
    $("#stnslist").append(html);
  }
  function initJggcInfo(prodList){
    var html='';
    $.each(prodList, function(index,item) {
      var inputsName=item.inputsName!=null?"投入品："+item.inputsName:"";
      var createUser=item.createUser!=null?"负责人："+item.createUser:"";
      var className = index==0?"listItem-first":index==prodList.length-1?"listItem-last":"";
      html+=`<div class="listItem `+className+`">
						<div class="listItemContent">
							<div class="type">`+item.procName+`</div>
							<div class="content">
								  `+item.createdAt+`  <br>
							</div>
						</div>
					</div>`;
    });
    $("#jggclist").append(html);
  }
  //生成图片轮播
  function createSlider(images){
    var html ='';
    var imgarray = images.split(",");
    if(imgarray.length>1){
      html+='<div class="mui-slider" >';
      html +='<div class="mui-slider-group mui-slider-loop">';
      var zhtml='<div class="mui-slider-indicator mui-text-right">';
      $.each(imgarray, function(index,img) {
        var imgs =pre_img+img;// pms_img+img;
        html+='<div class="mui-slider-item">'+
          '<a href="#"><img src="'+imgs+'"  data-preview-src  data-preview-group="1"/></a></div>';
        if(index==0){
          zhtml+='<div class="mui-indicator mui-active"></div>';
        }else{
          zhtml+='<div class="mui-indicator"></div>';
        }
      });
      html+='</div>';
      zhtml+='</div>';
      html+=zhtml+"</div>";
    }else{
      var pic = pre_img+images;
      html+='<img src="'+pic+'" data-preview-src  data-preview-group="1"/>';
    }
    return html;
  }
  function testImgs (images,type){
    var html ='';
    if(images==null){
      return html;
    }
    var imgarray = images.split(",");
    if(imgarray.length == 1) {
      var pic = pre_img+images;
      if(images.indexOf("pdf") !== -1){
        var $button = $("<button/>");
        $button.on("click",function(){
          window.open(pre_img+images);
        })
        html = $button;
      }else{
        html+='<img src="'+pic+'" data-preview-src  data-preview-group="'+type+'"/>';
      }

    } else {
      html+='<div class="mui-slider" >';
      html +='<div class="mui-slider-group mui-slider-loop">';

      //<!-- 额外增加的一个节点(循环轮播：第一个节点是最后一张轮播) -->
      for(var i = imgarray.length-1; i >=0 ; i--){
        if(imgarray[i].indexOf("pdf") === -1){
          html+='<div class="mui-slider-item mui-slider-item-duplicate">'+
            '<a href="#">'+
            '<img src="'+pre_img+imgarray[i]+'" >'+
            '</a>'+
            '</div>';
          break;
        }
      }
      var zhtml='<div class="mui-slider-indicator mui-text-right">';
      for(var i = 0; i < imgarray.length; i++) {
        if(imgarray[i].indexOf("pdf")>-1){

        }else{
          html+='<div class="mui-slider-item">'+
            '<a href="#">'+
            '<img data-preview-src  data-preview-group="'+type+'" src="'+pre_img+imgarray[i]+'">'+
            '</a>'+
            '</div>';
          if(i==0){
            zhtml+='<div class="mui-indicator mui-active"></div>';
          }else{
            zhtml+='<div class="mui-indicator"></div>';
          }
        }
      }
      zhtml+='</div>';
      //<!-- 额外增加的一个节点(循环轮播：最后一个节点是第一张轮播) -->
      //循环判断获取到不是pdf为止返回
      for(var i = 0; i < imgarray.length; i++){
        if(imgarray[i].indexOf("pdf") === -1){
          html+='<div class="mui-slider-item mui-slider-item-duplicate">'+
            '<a href="#">'+
            '<img src="'+pre_img+imgarray[i]+'" >'+
            '</a>'+
            '</div>';
          break;
        }
      }
      html+='</div>';
      html+=zhtml+"</div>";
      for(var i = 0; i < imgarray.length; i++){
        if(imgarray[i].indexOf("pdf") > -1){
          html+='<button data="'+pre_img+imgarray[i]+'">监测报告下载</button>';
        }
      }
    }
    return html;
  }

  function testImgs1 (images,type){
    var html ='';
    if(images==null){
      return html;
    }
    var imgarray = images.split(",");
    if(imgarray.length === 1) {
      var pic = pre_img1+images;
      if(images.indexOf("pdf") !== -1){
        var $button = $("<button/>");
        $button.on("click",function(){
          window.open(pre_img1+images);
        })
        html = $button;
      }else{
        html+='<img src="'+pic+'" data-preview-src  data-preview-group="'+type+'"/>';
      }

    } else {
      html+='<div class="mui-slider" >';
      html +='<div class="mui-slider-group mui-slider-loop">';

      //<!-- 额外增加的一个节点(循环轮播：第一个节点是最后一张轮播) -->
      for(var i = imgarray.length-1; i >=0 ; i--){
        if(imgarray[i].indexOf("pdf") === -1){
          html+='<div class="mui-slider-item mui-slider-item-duplicate">'+
            '<a href="#">'+
            '<img src="'+pre_img+imgarray[i]+'" >'+
            '</a>'+
            '</div>';
          break;
        }
      }
      var zhtml='<div class="mui-slider-indicator mui-text-right">';
      for(var i = 0; i < imgarray.length; i++) {
        if(imgarray[i].indexOf("pdf")>-1){

        }else{
          html+='<div class="mui-slider-item">'+
            '<a href="#">'+
            '<img data-preview-src  data-preview-group="'+type+'" src="'+pre_img+imgarray[i]+'">'+
            '</a>'+
            '</div>';
          if(i==0){
            zhtml+='<div class="mui-indicator mui-active"></div>';
          }else{
            zhtml+='<div class="mui-indicator"></div>';
          }
        }
      }
      zhtml+='</div>';
      //<!-- 额外增加的一个节点(循环轮播：最后一个节点是第一张轮播) -->
      //循环判断获取到不是pdf为止返回
      for(var i = 0; i < imgarray.length; i++){
        if(imgarray[i].indexOf("pdf") === -1){
          html+='<div class="mui-slider-item mui-slider-item-duplicate">'+
            '<a href="#">'+
            '<img src="'+pre_img+imgarray[i]+'" >'+
            '</a>'+
            '</div>';
          break;
        }
      }
      html+='</div>';
      html+=zhtml+"</div>";
      for(var i = 0; i < imgarray.length; i++){
        if(imgarray[i].indexOf("pdf") > -1){
          html+='<button data="'+pre_img+imgarray[i]+'">监测报告下载</button>';
        }
      }
    }
    return html;
  }
  $(".arrow-line").click(function(){
    $(this).toggleClass("down");
    $(this).parent().next().toggleClass("hid");
  });

</script>
</body>
</html>